package net.ghsoft
{
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.utils.describeType;
	
	import mx.collections.ArrayCollection;
	
	import net.ghsoft.AppGlobal;
	
	import spark.components.Button;
	
	public class SetupGlobal
	{
		private static var _SetupData:String = "";		
		/**
		 * 主设置数据
		 */ 
		public static function set SetupData(value:String):void
		{
			if(value != null && value != "")
			{
				_SetupData = value;
				
				var oJSON:Object = JSON.parse(value);
				
				if(oJSON != null)
				{
					Timezone = oJSON["Timezone"];
					Interval = oJSON["Interval"];
					TemperautleUnit = oJSON["TemperautleUnit"];
					WindSpeedUnit = oJSON["WindSpeedUnit"];
					PressureUnit = oJSON["PressureUnit"];
					RainfallUnit = oJSON["RainfallUnit"];
					Day = oJSON["Day"];
					Time = oJSON["Time"];
					Chartcolumn = oJSON["Chartcolumn"];
					WindSpeed = oJSON["WindSpeed"];
					IndexTemperature = oJSON["IndexTemperature"];
					Rainfall = oJSON["Rainfall"];
					Pressure = oJSON["Pressure"];
					Relative = oJSON["Relative"];
				}
			}
		}
		
		/**
		 * 主设置数据
		 */ 
		public static function get SetupData():String
		{
			return _SetupData;
		}
		
		private static var _Timezone:String = "";		
		/**
		 * 时区设置
		 */ 
		public static function set Timezone(value:String):void
		{
			_Timezone = value;
		}
		
		/**
		 * 时区设置
		 */ 
		public static function get Timezone():String
		{
			return _Timezone;
		}
		
		private static var _Interval:String = "";
		/**
		 * 间隔设置
		 */ 
		public static function set Interval(value:String):void
		{
			_Interval = value;
		}
		
		/**
		 * 间隔设置
		 */ 
		public static function get Interval():String
		{
			return _Interval;
		}
		
		private static var _TemperautleUnit:String = "";
		/**
		 * 温度格式
		 */ 
		public static function set TemperautleUnit(value:String):void
		{
			_TemperautleUnit = value;
		}
		
		/**
		 * 温度格式
		 */ 
		public static function get TemperautleUnit():String
		{
			return _TemperautleUnit;
		}
		
		/**
		 * 本地温度格式
		 */ 
		public static function get TemperautleUnitLocal():String
		{
			var result:String = "C";
			if(_TemperautleUnit == "℉")
			{
				result = "F";
			}
				
			return result;
		}
		
		private static var _WindSpeedUnit:String = "";
		
		/**
		 * 风速格式
		 */ 
		public static function set WindSpeedUnit(value:String):void
		{
			_WindSpeedUnit = value;
		}
		
		/**
		 * 风速格式
		 */ 
		public static function get WindSpeedUnit():String
		{
			return _WindSpeedUnit;
		}
		
		private static var _PressureUnit:String = "";

		
		/**
		 * 气压格式
		 */ 
		public static function set PressureUnit(value:String):void
		{
			_PressureUnit = value;
		}
		
		/**
		 * 气压格式
		 */ 
		public static function get PressureUnit():String
		{
			return _PressureUnit;
		}
		
		/**
		 * 压力单位HPA、INHG或MMHG
		 */ 
		public static function get BarometerUnitLocal():String
		{
			var result:String = "HPA";
			var strTemp:String = _PressureUnit.toUpperCase();
			if(strTemp == "INHG")
			{
				result = "INHG";
			}
			else if(strTemp == "MMHG")
			{
				result = "MMHG";
			}
			
			return result;
		}
		
		private static var _RainfallUnit:String = "";
		
		/**
		 * 长度单位
		 */ 
		public static function set RainfallUnit(value:String):void
		{
			_RainfallUnit = value;
		}
		
		/**
		 * 长度单位
		 */ 
		public static function get RainfallUnit():String
		{
			return _RainfallUnit;
		}
		
		/**
		 * 长度单位IN或MM
		 */ 
		public static function get RainUnitLocal():String
		{
			var result:String = "MM";
			var strTemp:String = _RainfallUnit.toUpperCase();
			if(strTemp == "IN")
			{
				result = "IN";
			}
			
			return result;
		}
		

		
		private static var _Day:String = "";
		
		/**
		 * 日期设置
		 */ 
		public static function set Day(value:String):void
		{
			_Day = value;
		}
		
		/**
		 * 日期设置
		 */ 
		public static function get Day():String
		{
			return _Day;
		}
		
		/**
		 * 日期本地设置
		 */ 
		public static function get DayLocal():String
		{
			var result:String = "yyyy-MM-dd";
			
			if(_Day == "dd-mm-yy")
			{
				result = "dd-MM-yyyy";
			}
			else if(_Day == "mm-dd-yy")
			{
				result = "MM-dd-yyyy";
			}
			
			return result;
		}
		
		private static var _Time:String = "";
		
		/**
		 * 时间设置
		 */ 
		public static function set Time(value:String):void
		{
			_Time = value;
		}
		
		/**
		 * 时间设置
		 */ 
		public static function get Time():String
		{
			return _Time;
		}
		
		/**
		 * 时间本地设置
		 */ 
		public static function get TimeLocal():String
		{
			var result:String = "hh:mm";
			
			if(_Time == "12H")
			{
				result = "hh:mm a";
			}
			else if(_Time == "24H")
			{
				result = "HH:mm";
			}
			
			return result;
		}
		
		/**
		 * 时间本地设置
		 */ 
		public static function get FullTimeLocal():String
		{
			var result:String = "hh:mm:ss";
			
			if(_Time == "12H")
			{
				result = "hh:mm:ss a";
			}
			else if(_Time == "24H")
			{
				result = "HH:mm:ss";
			}
			
			return result;
		}

		private static var _Chartcolumn:String = "";
		
		public static function set Chartcolumn(value:String):void
		{
			_Chartcolumn = value;
		}
		
		public static function get Chartcolumn():String
		{
			return _Chartcolumn;
		}
		
		private static var _WindSpeed:String = "";
		
		public static function set WindSpeed(value:String):void
		{
			_WindSpeed = value;
		}
		
		public static function get WindSpeed():String
		{
			return _WindSpeed;
		}
		
		private static var _IndexTemperature:String = "";
		
		public static function set IndexTemperature(value:String):void
		{
			_IndexTemperature = value;
		}
		
		public static function get IndexTemperature():String
		{
			return _IndexTemperature;
		}
		
		private static var _Rainfall:String = "";
		
		public static function set Rainfall(value:String):void
		{
			_Rainfall = value;
		}
		
		public static function get Rainfall():String
		{
			return _Rainfall;
		}
		
		
		private static var _Pressure:String = "";
		
		public static function set Pressure(value:String):void
		{
			_Pressure = value;
		}
		
		public static function get Pressure():String
		{
			return _Pressure;
		}
		
		private static var _Relative:String = "";
		
		public static function set Relative(value:String):void
		{
			_Relative = value;
		}
		
		public static function get Relative():String
		{
			return _Relative;
		}

	}
}